package ATM;

import java.util.Objects;

public class Account {
    private String accountNumber;
    private String name;
    private double balance;
    private String password;

    public Account(String accountNumber,String name,double balance,String password)
    {
        this.accountNumber = accountNumber;
        this.name = name;
        this.balance = balance;
        this.password = password;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public boolean deposit(double amount)
    {
        if(amount>0)
        {
            this.balance += amount;
            return true;
        }
        return false;
    }

    public boolean withdraw(double amount)
    {
        if(amount > 0 && this.balance >= amount)
        {
            this.balance -= amount;
            return true;
        }
        return false;
    }

    public double getBalance()
    {
        return balance;
    }

    public boolean checkPassword(String password)
    {
        return Objects.equals(this.password,password);
    }
}
